package fr.umlv.m2.jee.spij.persistence.schedule.dao;


import fr.umlv.m2.jee.spij.framework.dao.hibernate.AbstractHibernateDAO;
import fr.umlv.m2.jee.spij.persistence.schedule.IReservationDAO;
import fr.umlv.m2.jee.spij.persistence.schedule.Reservation;
import org.springframework.stereotype.Repository;

@Repository("hibernateReservationDAO")
public class HibernateReservationDAO extends AbstractHibernateDAO<Long, Reservation>
        implements IReservationDAO {

    @Override
    public Reservation findReservationByLogin(String login) {
        StringBuilder query = new StringBuilder(
                "select Reservation from RES_RESERVATION as Reservation where RES_ACTOR_LOGIN = '");
        query.append(login);
        query.append("' ;");
        return findEntityByQuery(query.toString());
    }

}
